#include <sstream>

#include <Klein/Shader/Node.h>

Node::Node(const FragmentRef& fragment, const int number) :
	mNumber(number),
	mLabel(fragment->GetIdentifier().GetName()),
	mActived(false)
{
	mPosition[0] = mPosition[1] = 0;

	mParameterGroup.reset(new ParameterGroup(*fragment->GetParameterGroup()));
}

Node::~Node()
{
}

int Node::GetNumber() const
{
	return mNumber;
}

void Node::SetLabel(const String& label)
{
	mLabel = label;
}

const String& Node::GetLabel() const
{
	return mLabel;
}

void Node::SetPosition(const int x, const int y)
{
	mPosition[0] = x;
	mPosition[1] = y;
}

int Node::GetPositionX() const
{
	return mPosition[0];
}

int Node::GetPositionY() const
{
	return mPosition[1];
}

void Node::Active(const bool active)
{
	mActived = active;
}

bool Node::GetActived() const
{
	return mActived;
}

ParameterGroupRef Node::GetParameterGroup() const
{
	return mParameterGroup;
}

void Node::SetParameter(const String& parameterName, const String& parameterValue)
{
	mParameterGroup->SetParameter(parameterName, parameterValue);
}
